<template>
	<view class="content">
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				root: {},
				selected: null,
				checked: [],
				allExpand: false,
			}
		},
		methods: {
			onChange(selected) {
				console.log(selected)
			},
			onClick(item) {
				console.log(item)
			},
			getChecked() {
				const checked = this.$refs.tree.getChecked()
				const allChecked = this.$refs.tree.getAllChecked()
				console.log(checked, allChecked)
			},
			toggleExpand() {
				this.allExpand = !this.allExpand
				this.$refs.tree.toggleAllExpand(this.allExpand)
			},
		},
		onLoad() {
			setTimeout(() => {
				this.root = {
					children: [
						{
							id: 'jiangsu',
							name: '江苏省',
							children: [{
								id: 'nanjing',
								name: '南京市',
								children: [{
										id: 'pukou',
										name: '浦口区',
									},
									{
										id: 'jiangning',
										name: '江宁区',
									}
								]
							}, ]
						},
						{
							id: 'zhejiang',
							name: '浙江省',
							children: [{
								id: 'hangzhou',
								name: '杭州市',
								children: [{
									id: 'yuhang1',
									name: '余杭区',
								}, {
									id: 'yuhang2',
									name: '余杭区',
								},{
									id: 'yuhang3',
									name: '余杭区',
								},{
									id: 'yuhang4',
									name: '余杭区',
								},{
									id: 'yuhang5',
									name: '余杭区',
								},{
									id: 'yuhang6',
									name: '余杭区',
								},]
							}, ]
						},
					]
				}
				this.selected = {
					id: 'pukou',
				}
				this.checked = [{
					id: 'jiangning'
				}]
			}, 1000)
		},

	}
</script>

<style>
	h1 {
		color: red;
	}
</style>
